package pack0711;

import java.io.*;
import java.util.List;

//演示对象输入字节流的使用
public class ObjectInputStreamDemo {

    public static void main(String[] args) throws Exception {

        //创建一个对象输入流
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("b.txt"));

//        User user1 = (User) ois.readObject();
//        User user2 = (User) ois.readObject();
//        User user3 = (User) ois.readObject();
//
//        System.out.println(user1);
//        System.out.println(user2);
//        System.out.println(user3);

        List<User>list=(List<User>)ois.readObject();

        for(User user:list){
            System.out.println(user);
        }
        ois.close();

    }
}
